package puzzle.projecteuler.p300;


public class Problem207C {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		long x = 10L;
		long y = 100000000000L;
		long m;
		long[] s;
		while (y>x+1) {
			m = (x+y)/2;
			s = p(m);
			if (s[0]*12345 < s[1]) {
				y = m;
			} else {
				x = m;
			}
		}
		System.out.println(y);
	}

	
	public static long[] p(long m) {
		
		long t = (long)Math.floor((Math.sqrt(4*m+1)+1)/2.0);
		long s = (long)Math.floor(Math.log(t)/Math.log(2));
		return new long[] {s, t-1};
	}
}
